%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/connections/order.variables.strings"
    Bucket0("Bucket 0 (root)<br /><br />1: PgSelectInlineApply[54]<br />ᐳ: 10, 12, 15, 16, 59, 60, 17, 21, 58, 19<br />2: PgSelect[14], PgSelect[26]<br />ᐳ: Access[36], Access[55]<br />3: Connection[18], PgSelectRows[28]<br />ᐳ: 27, 29, 30<br />4: ConnectionItems[22]<br />ᐳ: 35, 37, 38, 39"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 18, 36, 22, 55, 30, 37, 39<br /><br />ROOT Connectionᐸ14ᐳ[18]"):::bucket
    Bucket3("Bucket 3 (listItem)<br />Deps: 36, 55<br /><br />ROOT __Item{3}ᐸ22ᐳ[31]"):::bucket
    Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 31, 32, 55, 41<br /><br />ROOT Edge{3}[32]"):::bucket
    Bucket5("Bucket 5 (nullableBoundary)<br />Deps: 42, 55<br /><br />ROOT PgSelectSingle{4}ᐸmessagesᐳ[42]<br />1: <br />ᐳ: 43, 56, 57<br />2: PgSelectRows[50]<br />ᐳ: First[49], PgSelectSingle[51]"):::bucket
    Bucket6("Bucket 6 (nullableBoundary)<br />Deps: 51<br /><br />ROOT PgSelectSingle{5}ᐸusersᐳ[51]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket3
    Bucket3 --> Bucket4
    Bucket4 --> Bucket5
    Bucket5 --> Bucket6

    %% plan dependencies
    PgSelect14[["PgSelect[14∈0] ➊<br />ᐸmessages+1ᐳ<br />More deps:<br />- Constantᐸ5ᐳ[60]"]]:::plan
    Object17{{"Object[17∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    ApplyInput19{{"ApplyInput[19∈0] ➊"}}:::plan
    Lambda21{{"Lambda[21∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'INHERIT' ]ᐳ[59]"}}:::plan
    PgSelectInlineApply54["PgSelectInlineApply[54∈0] ➊"]:::plan
    Object17 & ApplyInput19 & Lambda21 & PgSelectInlineApply54 --> PgSelect14
    PgSelect26[["PgSelect[26∈0] ➊<br />ᐸmessages(aggregate)ᐳ<br />More deps:<br />- Constantᐸ5ᐳ[60]"]]:::plan
    Object17 & ApplyInput19 & Lambda21 --> PgSelect26
    Access15{{"Access[15∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access16{{"Access[16∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access15 & Access16 --> Object17
    Connection18[["Connection[18∈0] ➊<br />ᐸ14ᐳ<br />Dependents: 4<br />More deps:<br />- Constantᐸ5ᐳ[60]"]]:::plan
    PgSelect14 --> Connection18
    List58{{"List[58∈0] ➊<br />ᐸ10,12ᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ0.string1ᐳ"}}:::plan
    Access12{{"Access[12∈0] ➊<br />ᐸ0.string2ᐳ"}}:::plan
    Access10 & Access12 --> List58
    __Value0["__Value[0∈0] ➊<br />ᐸvariableValuesᐳ"]:::plan
    __Value0 --> Access10
    __Value0 --> Access12
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access15
    __Value2 --> Access16
    List58 --> ApplyInput19
    ConnectionItems22[["ConnectionItems[22∈0] ➊<br />Dependents: 3<br />More deps:<br />- Connection[18]"]]:::plan
    First27{{"First[27∈0] ➊"}}:::plan
    PgSelectRows28[["PgSelectRows[28∈0] ➊"]]:::plan
    PgSelectRows28 --> First27
    PgSelect26 --> PgSelectRows28
    PgSelectSingle29{{"PgSelectSingle[29∈0] ➊<br />ᐸmessagesᐳ"}}:::plan
    First27 --> PgSelectSingle29
    First35{{"First[35∈0] ➊<br />More deps:<br />- ConnectionItems[22]"}}:::plan
    Access36{{"Access[36∈0] ➊<br />ᐸ14.cursorDetailsᐳ<br />Dependents: 3"}}:::plan
    PgSelect14 --> Access36
    Last38{{"Last[38∈0] ➊<br />More deps:<br />- ConnectionItems[22]"}}:::plan
    Access55{{"Access[55∈0] ➊<br />ᐸ14.m.joinDetailsFor45ᐳ"}}:::plan
    PgSelect14 --> Access55
    PageInfo25{{"PageInfo[25∈1] ➊<br />More deps:<br />- Connection[18]"}}:::plan
    Access33{{"Access[33∈1] ➊<br />ᐸ18.hasNextPageᐳ<br />More deps:<br />- Connection[18]"}}:::plan
    Access34{{"Access[34∈1] ➊<br />ᐸ18.hasPreviousPageᐳ<br />More deps:<br />- Connection[18]"}}:::plan
    Edge32{{"Edge[32∈3]"}}:::plan
    __Item31[/"__Item[31∈3]<br />ᐸ22ᐳ<br />More deps:<br />- ConnectionItems[22]"\]:::itemplan
    PgCursor41{{"PgCursor[41∈3]<br />More deps:<br />- Access[36]"}}:::plan
    __Item31 & PgCursor41 --> Edge32
    __Item31 --> PgCursor41
    PgSelectSingle42{{"PgSelectSingle[42∈4]<br />ᐸmessagesᐳ"}}:::plan
    __Item31 --> PgSelectSingle42
    List56{{"List[56∈5]<br />ᐸ55,42ᐳ"}}:::plan
    Access55 & PgSelectSingle42 --> List56
    PgClassExpression43{{"PgClassExpression[43∈5]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle42 --> PgClassExpression43
    First49{{"First[49∈5]"}}:::plan
    PgSelectRows50[["PgSelectRows[50∈5]"]]:::plan
    PgSelectRows50 --> First49
    Lambda57{{"Lambda[57∈5]<br />ᐸpgInlineViaJoinTransformᐳ"}}:::plan
    Lambda57 --> PgSelectRows50
    PgSelectSingle51{{"PgSelectSingle[51∈5]<br />ᐸusersᐳ"}}:::plan
    First49 --> PgSelectSingle51
    List56 --> Lambda57
    PgClassExpression52{{"PgClassExpression[52∈6]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle51 --> PgClassExpression52
    PgClassExpression53{{"PgClassExpression[53∈6]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression52 o--o PgClassExpression53

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value0,__Value2,Access10,Access12,PgSelect14,Access15,Access16,Object17,Connection18,ApplyInput19,Lambda21,ConnectionItems22,PgSelect26,First27,PgSelectRows28,PgSelectSingle29,First35,Access36,Last38,PgSelectInlineApply54,Access55,List58 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PageInfo25,Access33,Access34 bucket1
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item31,Edge32,PgCursor41 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgSelectSingle42 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,PgClassExpression43,First49,PgSelectRows50,PgSelectSingle51,List56,Lambda57 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6,PgClassExpression52,PgClassExpression53 bucket6

